using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace XNALibrary.Cameras
{
    public class ThreePerson : Camera
    {
        public ThreePerson(Vector3 position)
            : base(position)
        {
 
        }

        public void Update(Vector3 modelPosition, float modelRotationY)
        {
            Vector3 modelVelocityAdd = Vector3.Zero;

            modelVelocityAdd.X = -(float)Math.Sin(modelRotationY);
            modelVelocityAdd.Z = -(float)Math.Cos(modelRotationY);

            modelVelocityAdd *= new Vector3(-300, 1000, -5000);

            Vector3 pivot = modelPosition + modelVelocityAdd;
            position.X = this.position.X + ((pivot.X - this.position.X) / 8f);
            position.Y = this.position.Y + ((pivot.Y - this.position.Y) / 8f);
            position.Z = this.position.Z + ((pivot.Z - this.position.Z) / 8f);

            View = Matrix.CreateLookAt(this.position, Lookat, Vector3.Up);
        }
    }
}
